{extend name="common@base" /}
{block name="content"}
<section class="content" id="container">
  <div class="box box-default collapsed-box">
    <div class="box-header with-border">
      <h3 class="box-title">查询</h3>
      <div class="box-tools pull-right">
        <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-plus"></i>
        </button>
      </div>
    </div>
    <div class="box-body">
      <form action="" method="get" name="search" class="form">
        <div class="form-group">
          <label for="">卡号或者真实姓名
            <input type="text" name="search[username]" value="{$search[username]}"
                   class="form-control"> </label>
          {if $roleId==1}
          <label for="">班级 {:form_dropdown('search[class_id]',$classes,$search.class_id,'class="form-control"')}</label>
          {/if}
          <button type="submit" class="btn btn-default btn-sm">查询</button>
          <a href="{:url('index')}" class="btn btn-default btn-sm">重置</a>
        </div>
      </form>
    </div>
  </div>
  <div class="box box-primary">
    <div class="box-header with-border">
      <h3 class="box-title">
        考生列表
      </h3>
      <div class="box-tools pull-right">
        <a href="{:url('edit')}" class="btn btn-primary">新增</a>
        {if $roleId==1}
        <a href="{:url('import')}" class="btn btn-default">导入</a>
        {/if}
      </div>
    </div>
    <div class="box-body table-responsive">
      <form action="batchdelete" method="post">
        <table id="myTable" class="table table-striped">
          <thead>
          <tr>
            <th width="50">选择</th>
            <th width="50">ID</th>
            <th width="100">真实姓名</th>
            <th width="200">一卡通</th>
            <th>班级</th>
            <th>性别</th>
            <th>入学时间</th>
            <th>最近考试得分</th>
            <th>考试次数</th>
            <th>承诺书</th>
            <th>状态</th>
            <th>操作</th>
          </tr>
          </thead>
          <tbody>
          {foreach $rows as $row}
          <tr>
            <td style="text-align: center"><input type="checkbox" name="ids[]" value="{$row.id}" class="js-user-ids"></td>
            <td>{$row.id}</td>
            <td>{$row.realname}</td>
            <td>{$row.username}</td>
            <td>{$row.class_title}</td>
            <td>{$row.sexText}</td>
            <td>{$row.join_time}</td>
            <td>{$row.exam_score}</td>
            <td>{$row.exam_times}</td>
            <td>{$row.commitmentText}</td>
            <td>{$row.statusText}</td>
            <td>
              <a href="{:url('edit',['id'=>$row.id])}" class="btn btn-default btn-sm">编辑</a>
              <a href="{:url('resetpw',['id'=>$row.id])}" class="btn btn-default btn-sm js-confirm">重置密码</a>
            </td>
          </tr>
          {/foreach}
          <tr>
            <td style="text-align: center">
              <input type="checkbox" class="js-check-all"></td>
            <td>
              <button class="btn btn-xs btn-danger js-ajax-submit" data-message="确定执行该操作吗？">选择删除</button>
            </td>
          </tr>
          </tbody>
        </table>
      </form>
    </div>
    <div class="box-footer">
      {$rows->render()}
    </div>
  </div>

</section>
{/block}
{block name="page_script"}
<script>
  require(["layer_config", "ajaxForm"], function () {
    $(".js-check-all").on("click", function () {
      var me=$(this);
      var objs = $(".js-user-ids");
      objs.prop("checked", me.prop("checked"));
    });
  });

</script>
{/block}
</body>
</html>
